import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { PayAppAccountVO, PayAppAccountForm, PayAppAccountQuery } from '@/api/system/PayAppAccount/types';

/**
 * 查询应用收款账号列表
 * @param query
 * @returns {*}
 */

export const listPayAppAccount = (query?: PayAppAccountQuery): AxiosPromise<PayAppAccountVO[]> => {
  return request({
    url: '/system/PayGroupAccount/list',
    method: 'get',
    params: query
  });
};

export const PayChartGroupType = (groupId: any) => {
  return request({
    url: '/system/PayChart/groupType',
    method: 'post',
    data: {
      groupId
    }
  });
};


/**
 * 查询应用收款账号详细
 * @param id
 */
export const getPayAppAccount = (id: string | number): AxiosPromise<PayAppAccountVO> => {
  return request({
    url: '/system/PayGroupAccount/' + id,
    method: 'get'
  });
};

/**
 * 查询未绑定账号
 * @param params
 */
export const getPayAppAccountNoBinds = (params) => {
  return request({
    url: '/system/PayAccount/noBinds',
    method: 'get',
    params
  });
};

/**
 * 批量新增应用收款账号
 * @param params
 */
export const addBatchAccount = (data) => {
  return request({
    url: '/system/PayGroupAccount/addBatch',
    method: 'post',
    data
  });
};

/**
 * 新增应用收款账号
 * @param data
 */
export const addPayAppAccount = (data: PayAppAccountForm) => {
  return request({
    url: '/system/PayGroupAccount',
    method: 'post',
    data: data
  });
};

/**
 * 修改应用收款账号
 * @param data
 */
export const updatePayAppAccount = (data: PayAppAccountForm) => {
  return request({
    url: '/system/PayGroupAccount',
    method: 'put',
    data: data
  });
};

/**
 * 删除应用收款账号
 * @param id
 */
export const delPayAppAccount = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/PayGroupAccount/' + id,
    method: 'delete'
  });
};
